/*
 * \brief  Client-side input session interface
 * \author Norman Feske
 * \date   2006-08-16
 */

/*
 * Copyright (C) 2006-2009 Norman Feske
 * Genode Labs, Feske & Helmuth Systementwicklung GbR
 *
 * This file is part of the Genode OS framework, which is distributed
 * under the terms of the GNU General Public License version 2.
 */

#ifndef _INCLUDE__INPUT_SESSION__CLIENT_H_
#define _INCLUDE__INPUT_SESSION__CLIENT_H_

#include <input_session/capability.h>
#include <base/ipc.h>

namespace Input {

	class Session_client : public Session
	{
		private:

			Genode::Msgbuf<32> _snd_msg, _rcv_msg;
			Genode::Ipc_client _ipc_client;

		public:

			/**
			 * Constructor
			 */
			explicit Session_client(Session_capability session)
			: _ipc_client(session, &_snd_msg, &_rcv_msg) { }


			/*****************************
			 ** Input session interface **
			 *****************************/

			Genode::Dataspace_capability dataspace()
			{
				Genode::Dataspace_capability result;
				_ipc_client << DATASPACE << Genode::IPC_CALL >> result;
				return result;
			}

			bool is_pending() {
				return (_ipc_client << IS_PENDING << Genode::IPC_CALL); }

			int flush() {
				return (_ipc_client << FLUSH << Genode::IPC_CALL); }
	};
}

#endif /* _INCLUDE__INPUT_SESSION__CLIENT_H_ */
